package 计数法.好数对的数目;

/**
 * TODO
 *
 * @className: hsddsm
 * @description: TODO
 * @author: 等什么柠檬君
 * @date: 2022-05-05 19:35
 **/
public class hsddsm {
    public static void main(String[] args) {
        int[] nums = {1,2,3,1,1,3};
        System.out.println(numIdenticalPairs(nums));
    }
    public static int numIdenticalPairs(int[] nums) {
        int count = 0;
        for(int i = 0; i < nums.length; ++i){
            for(int j = 0; j < nums.length; ++j){
                if(nums[i]==nums[j] && i < j){
                    ++count;
                }
            }
        }
        return count;
    }
}
